﻿namespace hr_1.Model
{
    public class PersonalInfo
    {
        HRDataContext hrData = new HRDataContext();
        public int PersonalInfoId { get; set; }
        public string HomePhone { get; set; } 
        public string MobilePhone { get; set; }
        public string Email { get; set; }
        public string FamilyStatus { get; set; } 
        public  string Address { get; set; }
        public string Nationality { get; set; }
        public string Citizenship { get; set; }

        public PersonalInfo() { }

        public void Save()
        {
            personal_info NewPersonalInfo = new personal_info
            {
                home_phone = HomePhone,
                mobile_phone = MobilePhone,
                email = Email,
                family_status = FamilyStatus,
                address = Address,
                nationality = Nationality,
                citizenship = Citizenship
            };
            hrData.personal_infos.InsertOnSubmit(NewPersonalInfo);
            hrData.SubmitChanges();
            PersonalInfoId = NewPersonalInfo.personal_infoId;
        }
    }
}
